<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改用户')" />
    <th:block th:include="include :: select2-css" />
</head>
<body>
<div class="main-content">
    <form class="form-horizontal m" id="form-assignment-edit" th:object="${assignment}">
        <input name="id" id="id" type="hidden" th:field="*{id}"  />
        <div class="form-group">
            <label class="col-sm-3 control-label">任务标题：</label>
            <div class="col-sm-9">
                <input type="text" name="title" readonly="readonly" th:field="*{title}" class="form-control" placeholder="请输入文本">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">完成时间：</label>
            <div class="col-sm-9">
                <input type="text" name="startDate" readonly="readonly" th:value="${#dates.format(assignment.startDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" style="width: 200px" >
            </div>
            <div class="col-sm-9" style="margin-left: 400px;margin-top: -33px" >
                <span>--</span>
            </div>
            <div class="col-sm-9" style="margin-left: 430px;margin-top: -33px" >
                <input type="text" name="endDate" readonly="readonly" th:value="${#dates.format(assignment.endDate, 'yyyy-MM-dd')}" class="form-control" style="width: 200px"  placeholder="yyyy-MM-dd" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label" >执行人员：</label>
            <div class="col-sm-9" style="width: 200px">

                <input type="text" name="dept_name" readonly="readonly" th:field="*{dept_name}" class="form-control" placeholder="请输入文本">

            </div>

            <div class="col-sm-9" style="margin-left: 450px;margin-top: -33px;width: 200px">

                <input type="text" name="user_name" readonly="readonly" th:field="*{user_name}" class="form-control" placeholder="请输入文本">

            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label" >任务状态：</label>
            <div class="col-sm-9" style="margin-left: 50px;width: 200px">

                <select class="form-control" id="astatus" readonly="readonly" th:field="*{astatus}"  name="astatus">
                    <option value="0">未完成</option>
                    <option value="1">已完成</option>
                    <option value="2">已放弃</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label" >紧急程度：</label>
            <div class="col-sm-9">
                <div class="col-sm-9">
                    <label class="radio-box" th:field="*{urgency}">

                        <input id="Radio1" disabled="disabled"  th:checked="${assignment.urgency == 0} ? true:false" class="form-control" value="0" type="radio" name="urgency">
                        普通</label>
                    <label class="radio-box">

                        <input id="Radio2" disabled="disabled" th:checked="${assignment.urgency == 1} ? true:false" class="form-control" value="1" type="radio" name="urgency">
                        紧急</label>
                    <label class="radio-box">

                        <input id="Radio3" disabled="disabled" th:checked="${assignment.urgency == 2} ? true:false" class="form-control" value="2" type="radio" name="urgency">
                        非常紧急</label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">任务内容：</label>
            <div class="col-sm-9">
                <input type="text" name="content"  readonly="readonly" th:field="*{content}" class="form-control" placeholder="请输入文本">
            </div>
        </div>
    </form>

</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
    var prefix = ctx + "cms/task";


    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-assignment-edit").serializeArray();
            $.operate.save(prefix + "/editSave",data);

        }
    }
    /*部门管理-修改-选择部门树*/
    function selectDeptTree() {
        var deptId = $("#treeId").val();
        if(deptId > 0) {
            var options = {
                title: '部门选择',
                width: "380",
                url: prefix + "/selectDeptTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        } else {
            $.modal.alertError("父部门不能选择");
        }
    }

    function doSubmit(index, layero){
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        alert(tree);
        if ($.tree.notAllowLastLevel(tree)) {
            var body = layer.getChildFrame('body', index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }
    }

</script>
</body>
</html>